<!--头部公共部分-->
{include file="common/header" /}

<div id="wodekehu" class="x-body" class="clear:both;">
    <div class="layui-row"
         style="padding-left:20px;border-left:1px solid #e5e5e5;border-right:1px solid #e5e5e5;">
        <div class="layui-form layui-col-md12 x-so layui-form-pane">
            <div class="layui-input-inline">
                <input type="text" name="campus_name" id="campus_name" placeholder="请输入校区名称筛选" autocomplete="off" class="layui-input">
            </div>
        </div>
    </div>
    <table class="layui-hide" id="LAY_table_user" lay-filter="table"></table>
</div>
<!--底部公共部分-->
{include file="common/footer" /}

<script>
    layui.use(['form', 'table','element', 'layer', 'laytpl'], function () {
        var $ = layui.$,
            form = layui.form,
            element = layui.element,
            table = layui.table,
            layer = layui.layer;

        var loading = layer.load();

        //数据表格 方法级渲染
        var tableIns = table.render({
            elem: '#LAY_table_user'
            , url: '{:url("Index/lists")}'
            , method: 'POST'
            , loading: true
            , parseData: function (res) { //res 即为原始返回的数据
                if (res.code === 1) {
                    res.code = 0;
                } else {
                    res.code = -1;
                }
                return {
                    "code": res.code, //解析接口状态
                    "msg": res.message, //解析提示文本
                    "count": res.data.total, //解析数据长度
                    "data": res.data.data //解析数据列表
                };
            },
            cols: [[
                {type: 'checkbox'},
               {field: 'campus_name', title: '全选', align: 'center'},
            ]]
            // , height: 'full-180'
            , page: false
            , done: function () {
                layer.close(loading);
            }
        });

        $("#campus_name").bind('input propertychange', function () {
            var campus_name = $("#campus_name").val();
            tableIns.reload({
                where: {
                    campus_name: campus_name
                }
            })
        });
    });
</script>